package com.zxy.personage.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.zxy.personage.entity.RemarkEntity;
import com.zxy.personage.service.RemarkService;
import com.zxy.common.utils.PageUtils;
import com.zxy.common.utils.R;



/**
 * 用户点评表
 *
 * @author axy
 * @email sunlightcs@gmail.com
 * @date 2022-04-23 16:51:24
 */
@RestController
@RequestMapping("personage/remark")
@CrossOrigin
public class RemarkController {
    @Autowired
    private RemarkService remarkService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = remarkService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{jid}")

    public R info(@PathVariable("jid") Integer jid){
		RemarkEntity remark = remarkService.getById(jid);

        return R.ok().put("remark", remark);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody RemarkEntity remark){
		remarkService.save(remark);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody RemarkEntity remark){
		remarkService.updateById(remark);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] jids){
		remarkService.removeByIds(Arrays.asList(jids));

        return R.ok();
    }

    @RequestMapping("/delete/{id}")
    public R delete(@PathVariable("id") Integer id){
        remarkService.removeById(id);

        return R.ok();
    }

}
